package com.xyw.code.study202007291.functiontet;

import java.util.function.Function;

/**
 * Created with IntelliJ IDEA.
 * User: xuyiwei
 * Date: 2020/7/30
 * Time: 上午8:49
 * Email: 1328312923@qq.com
 * Description: No Description
 **/
public class FunctionTest {

    public static void main(String[] args) {
        Function<String,String> function1 = string -> {
            System.out.println("function1:"+string);
            return "function1:"+string;
        };
        Function<String,String> function2 = string -> {
            System.out.println("function2:"+string);
            return "function2:"+string;
        };
        //按顺序执行
        function1.andThen(function2).apply("1111");
        //反着来
        function1.compose(function2).apply("2222");
    }
}
